package com.kaifamiao.kfm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kaifamiao.kfm.entity.SysRole;
import com.kaifamiao.kfm.service.SysRoleService;
import com.kaifamiao.kfm.mapper.SysRoleMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 10854
* @description 针对表【sys_role(角色信息表)】的数据库操作Service实现
* @createDate 2022-08-21 15:22:32
*/
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole>
    implements SysRoleService{

    @Override
    public List<SysRole> getRolesByUserId(Long userId) {
        return getBaseMapper().selectByUserId(userId);
    }

    @Override
    public List<Long> getRoleIdByUserId(Long userId) {
        if (userId != null){
            return getBaseMapper().selectRoleIdByUserId(userId);
        }
        return List.of();
    }
}




